import service from "@/utils/serviceApi"

// get方法
function get(url, params) {
    return new Promise(resolve => {
        service({
            url: url,
            method: "get",
            params
        }).then(res => {
            resolve(res)
        }).catch()
    })
}

// post方法
function post(url, data) {
    return new Promise(resolve => {
        service({
            url: url,
            method: "post",
            data
        }).then(res => {
            resolve(res)
        }).catch()
    })
}

// put方法
function put(url, data) {
    return new Promise(resolve => {
        service({
            url: url,
            method: "put",
            data
        }).then(res => {
            resolve(res)
        }).catch()
    })
}

// delete方法
function del(url, params) {
    return new Promise(resolve => {
        service({
            url: url,
            method: "delete",
            params
        }).then(res => {
            resolve(res)
        }).catch()
    })
}

export default {
    get,
    post,
    put,
    del
}